package com.example.moblie2021606143cwj0330;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private EditText edtTxtMainAccount;
    private EditText edtTxtMainPsw;
    private Button btnMainLogin;
    private Button btnMainReset;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initView();
        btnMainLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String account = edtTxtMainAccount.getText().toString();
                String password = edtTxtMainPsw.getText().toString();

                if (account.length() == 0) {
                    Log.i("登录", "请输入用户名");

                } else if (password.length() == 0) {
                    Log.i("登录", "请输入密码");
                } else {
                }

                if (account.equals("admin") & password.equals("123456")) {
                    Log.i("登录", "登录成功");
                } else {
                    Log.i("登录", "登录失败");
                }
              edtTxtMainAccount .setText(null);
              edtTxtMainPsw.setText(null);
            }
        });
        btnMainReset.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String Login = btnMainLogin.getText().toString();
                String Reset = btnMainReset.getText().toString();

            }
        });

    }



    private void initView() {
        edtTxtMainAccount = findViewById(R.id.edtTxt_main_account);
        edtTxtMainPsw = findViewById(R.id.edtTxt_main_psw);
        btnMainLogin = findViewById(R.id.btn_main_login);
        btnMainReset = findViewById(R.id.btn_main_reset);
    }
}
